package com.lovo.service.impl;

import com.lovo.bean.StudentDetailBean;
import com.lovo.dao.IStudentDetailDAO;
import com.lovo.service.IStudentDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class StudentDetailServiceImpl implements IStudentDetailService {
    @Resource
    private IStudentDetailDAO studentDetailDAO;
    @Override
    public List selectAll() {
        return studentDetailDAO.findAll();
    }

    @Override
    public StudentDetailBean selectById(Long id) {
        return studentDetailDAO.findById(id).get();
    }

    @Override
    public void add(StudentDetailBean studentDetailBean) {
        studentDetailDAO.save(studentDetailBean);
    }

    @Override
    public void update(StudentDetailBean studentDetailBean) {
        studentDetailDAO.save(studentDetailBean);
    }

    @Override
    public void delete(Long id) {
        studentDetailDAO.deleteById(id);
    }
}
